<?php

/**
 * winbinder 패키지 
 * 
 * 
 * @package php.ui.winbinder
 */


/**
 * WBGauge
 * 
 * Progress Bar 
 *
 * @package php.ui.winbinder
 */
class WBRange extends WBControl { 
	
	/**
	 * 생성자
	 * 
	 */
	public function __construct($options = array()) { 
		parent::__construct($options);
	}

	// 객체 초기화 
	protected function initComponent() { 
		parent::initComponent();	

		if (isset($this->text))	$this->setText($this->getOption('text'));
		if (isset($this->current))	$this->setCurrent($this->getOption('current'));
		if (isset($this->range))	$this->setRange($this->getOption('range'));
		if (isset($this->min) || isset($this->max)) $this->setRange(array('min' => intval($this->getOption('min')), 'max' => intval($this->getOption('max'))));
		if (isset($this->tooltip))  $this->setToolTip($this->getOption('tooltip'));
	}

	/**
	 * 현재 위치 얻어오기 
	 * 
	 * @return int
	 */
	public function getCurrent() { 
		return $this->getValue();
	}

	/**
	 * 현재 위치 설정 
	 * 
	 * @param int $pos
	 */
	public function setCurrent($pos = 0) { 
		$this->setValue($pos);
	}

	public function getRange() { 
		return $this->getOption('range');
	}

	public function setRange($range) { 
		if (!isset($this->range)) { 
			$this->setOption('range', $range);
		}

		return parent::setRange($range['min'], $range['max']);
	}

	public function setToolTip($tooltip) { 
		$this->setText(array(null, $tooltip));
	}
}

?>